<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Log;
use GuzzleHttp\Exception;

class GuzzleTest extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'guzzle:test';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Command description';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        //
        try{
            $client=new Client();
            $params=
            $params = [
                'headers' => [//请求头信息
                    'Authorization' => 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjMxNTY1NDYyNjJlNzEyNmJiZDBjYWFkMWRlZjMyNjU2MTk4ZWE3ZTY3MDlmNzdjNGI2ZDQyYmQ5Yzg0Yjg1NWI2NjMxZjhlOTM1NmQ1MTMzIn0.eyJhdWQiOiIyIiwianRpIjoiMzE1NjU0NjI2MmU3MTI2YmJkMGNhYWQxZGVmMzI2NTYxOThlYTdlNjcwOWY3N2M0YjZkNDJiZDljODRiODU1YjY2MzFmOGU5MzU2ZDUxMzMiLCJpYXQiOjE1NzI4Mjk0NDUsIm5iZiI6MTU3MjgyOTQ0NSwiZXhwIjoxNTc0MTI1NDQ1LCJzdWIiOiIxMDIzIiwic2NvcGVzIjpbIioiXX0.Q766YKKrznFxlA3hb9Cet38q5uduUQfLEjT1bV51zSNFIoAqLm9Ky74fdat6EZTdVyE4xYashGHJ1K8zZXNdNoqDywOmCN_F2cGE9pOVW7woiKt5EJy4DqYDpe50AmwlPKe0qT-iOsDPeNYPt1M7KAgJThvxlrrHmvXmjnxCaOs5ADPQdeXkVucBEKY8HxVTH5IXc2I1LsmT0PNXZeRuVlBNe2ItYraiO_voN0jtvAxZfaFHEtgDMccBPIiO2oZ5hueAcLyu-SlmPhXaZUpr0nP1NHXsYb4hpPaQghXKoGsxNDprYGMbK55IYOzEQNwiO13mb3d4qB0w5QuK0a-qjgIxbVeuzFvjHFdgd_BREvTSh81CtjWHZtvK4IX7gnbgE9Ay5f-uMForgP65NCxHQAKpPGDmRjCkTbQgNikeLO8vqlqzJBqAQ9ojym6t9Un5a9TlkpfE00c5-2fIkIDmFRVd10juHFdTSqLGKGgdX2sRJw4Do83HshjbUutzka-RPZ5E57edk18Xm16VkJCQLyOAioU2Eo6XpYwhq94WLyIpjaMYoS3BB0iV5TR8TIDF9inehWg1VA-Bi4agCjwdlv1SzxZ7pK24pJALoghCHGLlh66l1F5MDOBTuOj1qSzlbfjbL5BMnIVOixfQLrmWUZw691GzIhoAk8_KXRM4Hgc'
                ],
                /* 'headers' => [//请求头信息
                     'token' => 'VBkmpUn8BPMPPNXJnP8CvneYBpQFDdfnetnxQT3C...'
                 ],
                 'form_params' => [//附加参数
                     'first_name' => '周末啦',
                     'last_name' => 'lalala',
                     'email' => '123@qq.com',
                     'desc' => '周末啦周末啦周末啦周末啦',
                 ],
                 'json' => [//传数组
                     ['name'=>'zs','age'=>10],
                     ['name'=>'zs','age'=>10],
                     ['name'=>'zs','age'=>10],
                 ]*/
                'json' => [//传数组
                    ['name'=>'zs','age'=>10],
                    ['name'=>'zs','age'=>10],
                    ['name'=>'zs','age'=>10],
                ]
            ];
            $response=$client->request('GET','http://moad.millionsergroup.ma/api/forms/3?supRecordId=0',$params);
            $body = $response->getBody();
            dd($body);
        }catch (Exception $e){
            Log::info($e);
        }

    }
}
